package com.example.demo.utils;

import java.util.UUID;

/**
 * 描 述: <br/>
 * 作 者: hujingbo<br/>
 * 创 建：2018/8/10 17:00<br/>
 * 版 本：v1.0.0<br>
 * <p>
 * 历 史: (版本) 作者 时间 注释 <br/>
 */
public class UUIDUtils {

    private UUIDUtils() {
        throw new UnsupportedOperationException("you can't instantiate me...");
    }

    /**
     * 获取去掉“-”的UUID
     * @return
     */
    public static String getUUID(){
        StringBuilder builder = new StringBuilder();
        String str = UUID.randomUUID().toString();
        String[] split = str.split("-");
        for (String s : split) {
            builder.append(s);
        }
        return  builder.toString();
    }

    /**
     * 获取指定数目的去掉“-”的UUID
     * @return
     */
    public static String[] getUUID(int num){
        String[] ss = new String[num];
        for (int i = 0; i < num; i++) {
            ss[i] = getUUID();
        }
        return ss;
    }

}

